<template>
  <div>
    <base-layout
      ref="layout"
      :buttonList="buttonList"
      :mainHight="mainHight"
      :isPage="true"
      :showTitle="false"
      @onFuncBtn="onFuncBtn"
      @pageChange="pageChange"
      v-loading="loading"
    >
      <div slot="main">
        <base-table
        :border="true"
        :showIndex="false"
        :slotrow="true"
        :tableHeight="tableHeight"
        :tableData="tableData"
        :tableColumn="tableColumn"
        @radioChange="radioChange"
        :tabLoading.sync="tabLoading"
        >
        </base-table>
      </div>
    </base-layout>
  </div>
</template>

<script>
import baseLayout from "@/components/base/baseLayout";
import BaseTable from "@/components/base/baseTable/index.vue";
import { GetBillList } from "@/api/apis/flowPath"
export default {
  data() {
    return {
      mainHight: "calc(100vh - 85px)",
      tableHeight: "calc(100vh - 189px)",
      tabLoading: false,
      buttonList: [
        {
          type: "primary",
          menuName: "添加",
          icon: "el-icon-plus",
          function: "add",
        },
        {
          menuName: "编辑",
          function: "edit",
          icon: "el-icon-edit",
        },
        {
          type: "danger",
          menuName: "删除",
          function: "del",
          icon: "el-icon-delete",
        },
      ],
      tableData: [],
      tableColumn: [
        {
          label: "流程编号",
          prop: "wfCode",
          tooltip: true,
        },
        {
          label: "流程名称",
          prop: "wfName",
          tooltip: true,
        },
        {
          label: "创建日期",
          prop: "createDate",
          tooltip: true,
        },
        {
          label: "修改日期",
          prop: "updateDate",
          tooltip: true,
        },
        {
          label: "流程编号",
          prop: "wfName",
          tooltip: true,
        },
      ],
      pageModel: {
        page: 1, //当前页码
        limit: 10, //每页显示多少
        Sequence: "", //排列方式
        SequenceName: "" //需要排列的字段名
      },
      loading: false
    };
  },

  components: {
    baseLayout,
    BaseTable,
  },
  created() {
    this.init()
  },
  methods: {
    async init(){
      this.loading = true
      const res = await GetBillList(this.pageModel)
      if (res.success == "true") {
        this.tableData = res.data[1]
        this.$refs.layout.setPageTotal(res.data[0]);
        this.loading = false
      }
    },
    // 按钮点击
    onFuncBtn(btnEven) {
      if (btnEven.menuName == "添加") {
        
      } else if (btnEven.menuName == "编辑") {

      } else if (btnEven.menuName == "删除") {
        
      }
    },
    // 分页变化
    pageChange(model) {
      this.pageModel.page = model.page;
      this.pageModel.limit = model.limit;
      this.init()
    },
    // 数据单选事件
    radioChange() {},
  },
};
</script>
<style scoped lang="sass"></style>
